/* Copyright 2012 Dustin Mitchell <dmmitche [at] gmail [dot] com>
 *
 * Licensed under the GPLv3.  See included LICENSE.txt for full details.
 */

#include "hw_module.h"
#include "log.h"

int hw_module_enable (struct hw_module *mod)
{
  if (!mod)
    return -1;

  if (clock_enable (mod->clock) == -1) {
    log (LOG_ERR, "unable to enable module clock");
    return -1;
  }

  if (pin_mux_set_mode (mod->pin_mux_name, mod->pin_mux_mode) == -1) {
    log (LOG_ERR, "unable to set pin mux mode");
    return -1;
  }

  return 0;
}
